﻿<%@ Page Language="C#" CodeBehind="ManageCategories.aspx.cs" Inherits="Passageways.Modules.Rolodex.Islands.ViewContacts.ManageCategories" %>
<%@ Register TagPrefix="pw" Namespace="Passageways.WebControls" Assembly="Passageways.WebControls" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Manage Contact Categories</title>
    <pw:Theme runat="server" />
</head>
<body class="portalbodytext">
<form runat="server">
    <!-- TODO: add a page header, do not show breadcrumb or divider. Do include an icon-->
    <br />

	<!-- TODO: add a toolbar with a button to add a new category -->    

	<p>
	<!-- TODO: add a portal message, CtrlMessage -->
	</p>
    
    <asp:Panel ID="PnlAddNewCategory" runat="server" Visible="false">
		<!-- TODO: add a text divider with the text "Add New Contact Category" -->
        <table class="portalbodytext" cellspacing="0" cellpadding="2" width="100%">
            <tr>
                <td style="text-align: right; width: 80px;">Category Name:</td>
                <td><asp:TextBox ID="txtCategoryName" runat="server" CssClass="portalbodytext" Width="250px" /></td>
            </tr>
            <tr>
                <td style="text-align: right; vertical-align: top;">Description:</td>
                <td><asp:TextBox ID="txtCategoryDescription" runat="server" CssClass="portalbodytext" Width="250px" TextMode="MultiLine" Rows="6" /></td>
            </tr>
            <tr>
                <td colspan="2" style="text-align: right;">
					<pw:PageButtons runat="server"
						ButtonType="OkCancel"
						OnCancelClick="OnNewCategoryCancelClick"
						OnPageIncomplete="OnNewCategoryOkClick" />
                </td>
            </tr>
        </table>
    </asp:Panel>
    
    <asp:Panel ID="PnlEditCategory" runat="server" Visible="false">
		<!-- TODO: add a text divider with text "Edit Category" -->
        <table class="portalbodytext" cellspacing="0" cellpadding="2" width="100%">
            <tr>
                <td style="text-align: right; width: 80px;">Category Name:</td>
                <td><asp:TextBox ID="txtEditCategoryName" runat="server" CssClass="portalbodytext" Width="250px" /></td>
            </tr>
            <tr>
                <td style="text-align: right; vertical-align: top;">Description:</td>
                <td><asp:TextBox ID="txtEditCategoryDescription" runat="server" CssClass="portalbodytext" Width="250px" TextMode="MultiLine" Rows="6" /></td>
            </tr>
            <tr>
                <td colspan="2" style="text-align: right;">
					<pw:PageButtons runat="server"
						ButtonType="OkCancel"
						OnCancelClick="OnEditCategoryCancelClick"
						OnPageIncomplete="OnEditCategoryOkClick" />
                </td>
            </tr>
        </table>
    </asp:Panel>
    
    <asp:Panel ID="PnlActiveCategories" runat="server">
        <div class="GridTitleRow" style="padding: 2px;">Categories</div>
        <asp:DataGrid ID="GrdActiveCategories" runat="server"
            AutoGenerateColumns="False"
            CellSpacing="0"
            CellPadding="2"
			CssClass="Grid"
            DataKeyField="ID"
            GridLines="None"
            OnDeleteCommand="OnCategoryDeleteClick"
			OnEditCommand="OnCategoryEditClick"
			Width="100%">
			<AlternatingItemStyle CssClass="GridAlternatingItemRow" />
            <EditItemStyle VerticalAlign="Top" />
			<HeaderStyle CssClass="GridHeaderRow" />
			<ItemStyle CssClass="GridItemRow" VerticalAlign="Top" />
            <Columns>
				<asp:BoundColumn DataField="Name" HeaderText="Name" />
				<asp:BoundColumn DataField="Description" HeaderText="Description" />
				<asp:BoundColumn DataField="ContactCount" HeaderText="Contacts" HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right" />
				<asp:BoundColumn DataField="LastUpdateBy" HeaderText="Last Edit By" />
				<asp:BoundColumn DataField="LastUpdateDateTime" HeaderText="Last Edit On" DataFormatString="{0:M/d/yyy h:mm tt}" HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right" />
                <asp:TemplateColumn HeaderText="Edit" HeaderStyle-VerticalAlign="Middle" HeaderStyle-HorizontalAlign="Center" ItemStyle-VerticalAlign="Middle" ItemStyle-HorizontalAlign="Center">
                    <ItemTemplate>
                        <asp:LinkButton runat="server" CausesValidation="false" CommandName="Edit">
                            <asp:Image runat="server" ImageAlign="AbsMiddle" ImageUrl="~/Modules/Rolodex/images/edit.gif" />
						</asp:LinkButton>
                    </ItemTemplate>
                </asp:TemplateColumn>
                <asp:TemplateColumn HeaderText="Delete" HeaderStyle-VerticalAlign="Middle" HeaderStyle-HorizontalAlign="Center" ItemStyle-VerticalAlign="Middle" ItemStyle-HorizontalAlign="Center">
                    <ItemTemplate>
                        <asp:LinkButton runat="server" CausesValidation="false" CommandName="Delete">
                            <asp:Image runat="server" ImageAlign="AbsMiddle" ImageUrl="~/Modules/Rolodex/images/delete.gif" onclick="return confirm('Are you sure you want to delete this category?\n\nNOTE: All Contacts in this category will be lost.');" />
						</asp:LinkButton>
                    </ItemTemplate>
                </asp:TemplateColumn>
            </Columns>
        </asp:DataGrid>
    </asp:Panel>
    
</form>
</body>
</html>